package com.xy.ftp;

import cn.hutool.extra.ssh.JschUtil;
import cn.hutool.extra.ssh.Sftp;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpException;
import java.io.ByteArrayOutputStream;

public class SFtpUse {
    public static void main(String[] args) throws SftpException {
        Sftp sftp = JschUtil.createSftp("47.99.65.138", 22, "xy", "x");
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ChannelSftp client = sftp.getClient();
        client.get("/home/xy/health.log",out);
        System.out.println(out.toString());
        client.disconnect();
    }
}
